import { _decorator, Component, Node } from 'cc';
import { Jsons, Key, TaskConfig } from '../frame/common/Enums';
import resMgr from '../frame/managers/ResMgr';
import { aa } from '../frame/FrameCore';

class TaskSys {

    getTask():TaskConfig{
        let currentTask = aa.data.get(Key.CurrentTask);
        const currentConfig = resMgr.getJson(Jsons.taskConfig)[currentTask];
        return currentConfig;
    }
    nextTask(){
        let currentTask = aa.data.get(Key.CurrentTask);
        currentTask ++;
        const maxTaskLength = resMgr.getJson(Jsons.taskConfig).length;
        if(currentTask>=maxTaskLength) currentTask = 0;
        aa.data.set(Key.CurrentTaskAmount,0);
        aa.data.set(Key.CurrentTask,currentTask);
    }

}


const task = new TaskSys;

export default task;
